﻿using Autofac.Extras.DynamicProxy;
using Domain.Entity.Entities;
using Domain.Services.DomainServices;
using Infrastructure.Repositories;
using Infrastructure.UnitWork;
using TestDDD.CustomAttribute;
using TestDDD.Interceptors;

namespace TestDDD.Services
{
    [Intercept(typeof(TransactionInterceptor))]
    public class UserService(IUserRepository userRepository, IUserDomainService userDomainService, IUnitOfWork unitOfWork) : BaseService<User>(userRepository, unitOfWork), IUserService
    {
        [UseTransaction]
        public async Task<bool> ChangeUserName(int id, string userName)
        {
            bool flag = await userDomainService.ChangeUserName(id, userName);
            return flag;
        }
    }
}
